package com.bwie.system.api.factory;

import com.bwie.common.core.domain.Result;
import com.bwie.system.api.RemoteProductService;
import com.bwie.system.api.domain.SkuInfo;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.cloud.openfeign.FallbackFactory;
import org.springframework.stereotype.Component;

@Component
public class RemoteProductFallbackFactory implements FallbackFactory<RemoteProductService> {
    private static final Logger log = LoggerFactory.getLogger(RemoteProductFallbackFactory.class);

    @Override
    public RemoteProductService create(Throwable cause) {
        return new RemoteProductService() {
            @Override
            public Result<SkuInfo> getInfo(Long skuId) {
                return Result.error("批量添加es失败，错误信息是："+cause.getMessage());
            }

        };
    }
}
